package inc.zhugastrov.sellerform;

import static inc.zhugastrov.dbactions.DBActions.fillItems;
import static inc.zhugastrov.dbactions.DBActions.initDB;
import static inc.zhugastrov.dbactions.DBActions.fillBasket;
import static inc.zhugastrov.dbactions.DBActions.fillOrders;
import javax.swing.Box.Filler;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.JTabbedPane;
import javax.swing.UIManager;

public class MainSellerForm extends JFrame {
	private JTabbedPane tabbedPane;
	private MainPanel mainPanel;
	private BasketPanel basketPanel;
	private CurrentOrdersPane currentOrderPane;
	private ComplOrderPane complOrderPane;
	public MainSellerForm() {
		init();
	}

	private void init() {
		initDB();
		fillItems();
		fillBasket();
		fillOrders();
		mainPanel = MainPanel.getInstance();
		basketPanel = BasketPanel.getInstance();
		currentOrderPane = CurrentOrdersPane.getInstance();
		complOrderPane = ComplOrderPane.getInstance();
		tabbedPane = new JTabbedPane();

		tabbedPane.addTab("Main", mainPanel);
		tabbedPane.addTab("Basket", basketPanel);
		tabbedPane.addTab("Current orders", currentOrderPane);
		tabbedPane.addTab("Completed orders", complOrderPane);

		add(tabbedPane);

		this.setSize(600, 600);
		this.setDefaultCloseOperation(EXIT_ON_CLOSE);
		this.setVisible(true);
		pack();
	}

	public static void main(String[] args) {
		try {
			UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
		} catch (Exception e) {
			e.printStackTrace();
		}
		new MainSellerForm();

	}

}
